package com.example.mapper;

import com.example.pojo.Emp;
import com.example.pojo.EmpQueryParam;
import org.apache.ibatis.annotations.*;


import java.util.List;
import java.util.Map;

//员工表
@Mapper
public interface EmpMapper {


    //新增员工信息
    //获取到返回的主键
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into emp(username, name, gender, phone, job, salary, image, entry_date, dept_id, create_time, update_time)" +
            "values (#{username},#{name},#{gender},#{phone},#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")
    void insert(Emp emp);


    //条件查询员工信息,xml
    List<Emp> list(EmpQueryParam empQueryParam);

    //根据id删除员工基本信息xml
    void deleteEmp(List<Integer> empids);
    //根据id删除员工工作信息xml
    void deleteExpr(List<Integer> empexprids);

    //根据id查询员工信息及工作经历回显xml
    Emp selectByID(Integer id);

    //根据数据更新员工基本信息xml
    void update(Emp emp);

    //统计员工职位人数
    @MapKey("pos")
    List<Map<String,Object>> getEmpJobData();

    //统计员工性别人数
    @MapKey("name")
    List<Map<String, Object>> getEmpGenderData();

    //登录
    @Select("select id,username,name from emp where username=#{username} and password=#{password}")
    Emp login(Emp emp);
}
